import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    msgLists: [
      {
        content: '消息1',
        isRead: false
      },
      {
        content: '消息2',
        isRead: false
      },
      {
        content: '消息3',
        isRead: false
      },
      {
        content: '消息4',
        isRead: true
      }
    ]
  },
  mutations: {
    set_Read (state, index) {
      state.msgLists[index].isRead = true
    },
    del_Read (state, index) {
      state.msgLists.splice(index, 1)
    }
  },
  actions: {
  },
  modules: {
  },
  plugins: [createPersistedState()]
})
